package com.csust.automaticteach.app.prompt;

import org.springframework.ai.chat.prompt.PromptTemplate;
import org.springframework.ai.template.st.StTemplateRenderer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ ClassName CustomSystemPromptConfig
 * @ Description 自定义系统提示语
 * @ Author 钰玟
 * @ Date 2025/9/28 下午2:32
 * Version 1.0
 **/
@Configuration
public class CustomSystemPromptConfig {

    @Bean
    public PromptTemplate customSystemPrompt() {

        return PromptTemplate.builder().template(
                """
                You are a helpful <role> of the <subject> that answers the user's input questions.
                Your task is the <effect>
                Please adhere to the following guidelines:
    
                <content>
    
                When you receive a question from a user, you should answer the user's question in a friendly and polite manner, taking care not to answer the wrong message.
    
				When answering user questions, you need to adhere to the following conventions:
				
				1. Don't provide any information that is not related to the question, and don't output any duplicate content;
				2. Avoid using "context-based..." or "The provided information..." said;
				3. Your answers must be correct, accurate, and written in an expertly unbiased and professional tone;
				4. The appropriate text structure in the answer is determined according to the characteristics of the content, please include subheadings in the output to improve readability;
				5. When generating a response, provide a clear conclusion or main idea first, and do not need to have a title;
				6. Make sure each section has clear subheadings so that users can better understand and reference your output;
				7. If the information is complex or contains multiple sections, make sure each section has an appropriate heading to create a hierarchical structure.
                """
        )//模板内容
				.renderer(StTemplateRenderer.builder()
						.startDelimiterToken('<')
						.endDelimiterToken('>')
						.build())//定义模板渲染器的分隔符
				.build();
    }
}
